﻿@using KRM.Core
@model List<vWebHREmployeesRequest>
 <table class="table table-striped table-bordered table-hover dataTable dataTable-customsort" >
                          <thead>
                              <tr>
                                  <th>Status</th>
                                  <th>Type</th>
                                  <th>Employee</th>
                                  <th>StartDate</th>
                                  <th>EndDate</th>
                                  <th class="sort-desc">Date Created</th>
                                  <th>Date Approved</th>
                                  <th>Action</th>
                                  <th>View</th>
                              </tr>
                          </thead>
                          <tbody>
                              @foreach (var item   in Model)
                              {
                                  var statusClass = "";
                                  switch (item.BookStatusId)
                                  {
                                      case (int)BookStatus.Pending:
                                          statusClass = "info";
                                                      break;
                                                  case (int)BookStatus.Accepted:
                                          statusClass = "success";
                                                      break;
                                                  case (int)BookStatus.Declined:
                                          statusClass = "danger";
                                                      break;
                                                  case (int)BookStatus.Canceled:
                                          statusClass = "active";
                                                      break;
                                  }
                                  <tr class="@statusClass">
                                      <td style="text-align: center"><a href="/HolidayManagement/ViewHolidayRequest/@item.Id">@item.StatusName</a></td>
                                      <td style="text-align: center">@item.TypeName</td>
                                      <td style="text-align: center">@(item.PersonalRequestName)</td>
                                      <td style="text-align: center">@item.StartDate.ToString("MM/dd/yyyy")</td>
                                      <td style="text-align: center">@item.EndDate.ToString("MM/dd/yyyy")</td>
                                      <td style="text-align: center">@item.DateCreated</td>
                                      <td style="text-align: center">@(item.DateApproved==null?"":(item.DateApproved.ToString()))</td>
                                      <td style="text-align: center">
                                          @if (item.BookStatusId== (int) BookStatus.Pending)
                                          {
                                              <a   data-toggle="modal" onclick="ViewApproveModal(@item.Id) "class="btn btn-sm green" @(item.BookStatusId == (int) BookStatus.Pending ? "" : "disabled=disabled")>Approve <i class="m-icon-swapright m-icon-white"></i></a>
                                          }
                                          else if (item.BookStatusId== (int)BookStatus.Accepted)
                                          {
                                              <a  data-toggle="modal" onclick="ViewCancelModal(@item.Id) "class="btn btn-sm red">Cancel <i class="m-icon-swapright m-icon-white"></i></a>
                                          }
                                      </td>
                                      <td>
                                          <a  class="btn btn-sm blue"onclick="ViewHolidayRequest(@item.Id)" >View <i class="m-icon-swapright m-icon-white"></i>
                                          </a>
                                      </td>
                                  </tr>
                              }
                          </tbody>
                      </table>